package bstsetcode.homework;

/**
 * @author noob
 * @version 1.0
 * @date 2021/3/14 7:10
 */
public class InsertionSort01 {
    
    
    public static <E extends Comparable<E>> void sort(E[] data){

        for (int i = data.length-1; i >= 0 ; i--) {
            E value = data[i];
            int j ;
            for ( j = i; j + 1 < data.length && value.compareTo(data[j+1]) > 0 ; j++) {
                data[j]=data[j+1];
            }
            data[j]=value;
        }

    }

}
